package com.qf.spring.single;

/**
 * @author 郑大仙丶
 * @version 1.0
 * @date 2021/3/19 9:38
 */
public class Wifi {


    private static Wifi wifi = null;

    private Wifi(){ }


    public synchronized static Wifi getInstance(){
        // Java - 乱序执行(指令重排)
        // volatile - 禁止指令重排
        // 静态内部类....
        if(wifi == null){
            synchronized (Wifi.class) {
                if(wifi == null) {
                    wifi = new Wifi();
                    return wifi;
                }
            }
        }
        return wifi;
    }

}
